package com.gopay.cron.service.cloud.gen.bean;

import com.gopay.cron.web.vo.CloudAccountStatementVO;

/**
 * @author Chenyu Li
 * @description
 * @date 2017/11/13
 * Copyright (c) 2017. www.gopay.com.cn Inc.All rights reserved.
 */
public class WithdrawFileInfo {
    public static final String fileName = "05";
    public static final String fileFtpName = "子账户提现类";

    private static final String csvFtpFirstLine = "\"提现总笔数\",\"提现总金额\",\"提现总手续费\"";
    private static final String csvFtpSecondLine = "\"国付宝交易号\",\"商户订单号\",\"交易类型\",\"发起时间\",\"完成时间\",\"转入方协议号\",\"转账金额\",\"手续费\",\"手续费承担方\"";

    private StringBuilder csvFtpFirstLineContent = new StringBuilder();
    private StringBuilder csvFtpSecondLineContent = new StringBuilder();


    public String getFtpCsvContent() {
        StringBuilder sb = new StringBuilder(WithdrawFileInfo.csvFtpFirstLine);
        sb.append("\r\n").append(csvFtpFirstLineContent.toString());
        sb.append(WithdrawFileInfo.csvFtpSecondLine);
        sb.append("\r\n").append(csvFtpSecondLineContent.toString());
        return sb.toString();
    }

    public void addFtpFirstWithdrawFileLine(CloudAccountStatementVO vo) {
        addFtpFirstCsvFileLine(vo);
    }

    private void addFtpFirstCsvFileLine(CloudAccountStatementVO vo) {
        csvFtpFirstLineContent.append("\"").append(vo.getTotalCount()).append("\",")
                .append("\"").append(vo.getTotalTxnAmt()).append("\",")
                .append("\"").append(vo.getTotalFeeAmt()).append("\"")
                .append("\r\n");
    }
    public void addFtpSecondWithdrawFileLine(CloudAccountStatementVO vo) {
        addFtpSecondCsvFileLine(vo);
    }

    private void addFtpSecondCsvFileLine(CloudAccountStatementVO vo) {
        csvFtpSecondLineContent.append("\"").append(vo.getGopayOrderId()).append("\",")
                .append("\"").append(vo.getMerOrderId()).append("\",")
                .append("\"").append(vo.getGopayIntTxnCd()).append("\",")
                .append("\"").append(vo.getReqTime()).append("\",")
                .append("\"").append(vo.getTranFinishTime()).append("\",")
                .append("\"").append(vo.getAgreeId()).append("\",")
                .append("\"").append(vo.getMerTxnAmt()).append("\",")
                .append("\"").append(vo.getOrderFeeAmt()).append("\",")
                .append("\"").append(vo.getOrderFeePayer()).append("\"")
                .append("\r\n");
    }
}
